import React, {Component} from 'react';

class Counter extends Component {
  constructor (props) {
    super(props);
    this.state = {
      count: 0
    };
  }
  fnClick (e) {
    e.preventDefault(); // 组织默认事件
    this.setState({
      count: this.state.count + 1
    });
  }
  render () {
    return (
      <div>
        <p>{this.state.count}</p>
        <a href="#" onClick={this.fnClick.bind(this)}>更新</a>
      </div>
    );
  }
}

export default Counter;
